<?php
/**
 * Comments module for XOOPS
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       The Groups Project http://code.google.com/p/commentsforxoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         comments
 * @since           2.3.0
 * @author          Hui Xiao < xh.8326@gmail.com >
 * @version         $Id: ajax.comments.php Sat Jul 18 20:17:23 CST 2009
 */

include "header.php";
include XOOPS_ROOT_PATH."/class/template.php";
//$GLOBALS["xoops"]->services["logger"]->activated = false ;
$xoopsTpl = new XoopsTpl();
header("Content-Type:text/html; charset="._CHARSET);
$op = isset($_GET["op"]) ? trim($_GET["op"]) : "";
$comments_handler = xoops_getmodulehandler("comments","comments");
switch ($op) {
    default:
        $id = isset($_GET["id"]) ? intval($_GET["id"]) : 0;
        $module = isset($_GET["module"]) ? trim($_GET["module"]) : "";
        $start = isset($_GET["start"]) ? intval($_GET["start"]) : 0;
        if ( empty($module) ) {
            $module = $comments_handler->getItemidtoModule($id);
        }
        $limit = 10;
        $list = $comments_handler->getCommentsList($module, $id, 0, 0, $start, $limit);
        $isNew = true;
        $formurl = XOOPS_URL_DEFAULT."/modules/comments/action.ajax.php";
        include_once(dirname(__FILE__)."/include/form.comment.php");
        $xoops_userid = $xoopsUser ? $xoopsUser->getVar("uid") : 0;
        $xoopsTpl->assign(array("xoops_userid"=>$xoops_userid,"pagenav"=>$list["pagenav"],"comments"=>$list["list"],"comurl"=>XOOPS_URL_DEFAULT."/modules/comments/ajax.comments.php?id={$id}"));
        $xoopsTpl->display("db:comments_list.html");
        exit();
    break;
}
?>